<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="uiTags" prefix="ui"%>

<script type="text/javascript">
	function query(){
		var dmbh = getObject("dmbh").val();
		var params = new Object();
		params.dmbh = dmbh;
		asyRefreshDatagrid("codemanageGrid","code/queryCode",params);
	}
	function enterCodeAdd(){
		createResponse("新增code", 800, 500, "code/enterCodeAdd", "query()")
	}
	function enterCodeEdit(){
		var row = getSelectedRow("codemanageGrid");
		if(row){
			syscodeid = row.syscodeid;
			createResponse("编辑",800,500,"code/enterCodeEdit?syscodeid=" + syscodeid,"query()");
		}else{
			showWarnAlert("请先选中后再操作！");
			return;
		}
	}
	function codeDelete(){
		var row = getSelectedRow("codemanageGrid");
		var syscodeid;
		if(row){
			syscodeid = row.syscodeid;
			var params = new Object();
			params.syscodeid = syscodeid;
			ajaxRequest("code/codeDelete",params);
			query();
			showWarnAlert("删除成功！");
		}else{
			showWarnAlert("请先选中后再操作！");
			return;
		}	
	}
</script>
<ui:body>
	<div class="easyui-layout" style="width: 100%;height: 100%;" fit="true">
		<div data-options="region:'north',border:false" style="height: 110px">
		
			<ui:formtable id="usermanageForm" formlabel="code查询">
				<ui:dropdown id="dmbh" dsCode="dmbh" label="代码编号" ></ui:dropdown>
				<ui:buttons>
					<ui:button onclick="query()" value="查询" id="query" />
				</ui:buttons>
			</ui:formtable>
			
			
		</div>
		<div data-options="region:'center',border:false" style="overflow: hidden;">
		
			<ui:datagrid id="codemanageGrid" title="title">
				<ui:dgtoolbar exportflag="true">
					<ui:button onclick="enterCodeAdd()" value="新增" icon="icon-add" />
					<ui:button onclick="enterCodeEdit()" value="编辑"  icon="icon-mini-edit" />
					<ui:button onclick="codeDelete()" value="删除"  icon="icon-remove" />
				</ui:dgtoolbar>
				<ui:columntext  filed="syscodeid" text="" hidden="true"/>
				<ui:columntext text="代码名称" filed="dmmc"/>
				<ui:columntext text="代码编号" filed="dmbh"/>
				<ui:columntext text="code" filed="code" />
				<ui:columntext text="text" filed="text" />
				<ui:columntext text="顺序" filed="sx" />
			</ui:datagrid>
			
			
		</div>
	</div>
</ui:body>